home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-04 | 2.3 KB | 74 lines | [TEXT/MPS ] |
- #
- # File: CloseAllWindows.vu
- #
- # Contains: This script tries to close all windows that are open. A more
- # intelligent form can also be found in UtilityTasks.vulib
- #
- # Written by: P Nagarajan
- #
- # Requirements: none
- #
- # After Effects: Windows that were previously open will be closed.
- #
- # Copyright: © 1989-1992 by Apple Computer, Inc., all rights reserved.
- #
- # Change History (most recent first):
- #
- # 8/12/92 DGG Added check for dialogs with "Cancel" button
- # but no "OK" button.
- # 8/4/92 DGG "script" form added to main body
- # <7> 6/18/92 DGG Added check for "save/don't save" dialog
- # <6> 9/12/91 Rick Removed Store/Retrieve resources
- # 9/9/91 Rick Add check for 7.0 Finder Desktop window
- # 4/3/89 naga creation
- #
- # To Do:
- #
-
- (************************************************************************************
- * Task CheckForDialog()
- * This will attempt to handle "are you sure" dialogs that may be encountered
- * when closing document windows.
- ************************************************************************************)
- task CheckForDialog()
- begin
- if (match [window o:1 s:dialog])
- begin
- match [staticText t:?theText w:[window o:1]];
- if ((theText ~= /Save≈/) or (theText ~= /Do you want to save≈/))
- if (match [button t:"No"])
- select [button t:"No"];
- else if (match [button t:/Don≈/])
- select [button t:/Don≈/];
- end;
- end;
-
- (************************************************************************************
- * Main Body
- * This script will count all the windows present and try to close them.
- ************************************************************************************)
- script CloseAllWindowsMain()
- begin
- allWindows := collect [window];
- totalWindows := card allWindows;
- for i:= 1 to totalWindows do
- begin
- match [window s:?topWindowStyle o:1];
- if (topWindowStyle = dialog)
- begin
- if match [button t:'OK' w:[window o:1]]!
- select [button t:'OK' w:[window o:1]]!;
- else if match [button t:'Cancel' w:[window o:1]]!
- select [button t:'Cancel' w:[window o:1]]!;
- end;
- else if not ( # skip 7.0 Finder desktop window
- match[system v:/7.≈/]! # system 7 ?
- and match[application t:"Finder"]! # finder ?
- and match[window t:"Desktop" o:1]! # Desktop window ?
- )
- begin
- close [window o:1];
- CheckForDialog();
- end;
- end;
- end;